package org.theSeed.fileConfig.pojo.prop;

import cn.hutool.core.util.ObjectUtil;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.theSeed.base.exp.ServiceExp;
import org.theSeed.fileContract.exp.FileUploadExp;
import org.theSeed.fileContract.pojo.prop.FileConfigProp;

import javax.annotation.PostConstruct;
import java.util.Map;

/**
 * seed文件上传集成配置
 */
@Getter
@Setter
@Configuration
@ConfigurationProperties(prefix = "seed.file-upload")
public class SeedFileUploadProp {
    /**
     * 启用实例
     */
    private String activeInstanceName;

    /**
     * 系统文件配置
     */
    private Map<String,Map<String,Object>> fileConfigMap;

    /**
     * 文件单片大小,单位kb
     */
    private Long chipFileSize = 1024 * 2l;

    @PostConstruct
    public void init(){
        if (ObjectUtil.isEmpty(activeInstanceName)){
            throw new FileUploadExp("文件配置默认使用实例名称activeInstanceName不能为空");
        }
    }
}
